//
//  ClassDetailsViewController.m
//  ai2
//
//  Created by 杜超男 on 2019/3/19.
//  Copyright © 2019年 杜超男. All rights reserved.
//

#import "ClassDetailsViewController.h"
#import "ClassDetailsTableViewCell.h"
#import "AddClassDetailsViewController.h"
#import "Masonry.h"
@interface ClassDetailsViewController ()<UITableViewDelegate , UITableViewDataSource>
{
    UIButton *AddStudents;
}
@property (nonatomic , strong)UITableView *tableView;
@end

@implementation ClassDetailsViewController
-(void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBar.hidden = YES;
    self.tabBarController.tabBar.hidden = YES;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.tableView registerNib:[UINib nibWithNibName:@"ClassDetailsTableViewCell" bundle:nil] forCellReuseIdentifier:@"ClassDetailsTableViewCell"];
    [self.view addSubview:self.tableView];
    [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.view.mas_safeAreaLayoutGuideTop).inset(130);
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.bottom.mas_equalTo(self.view.mas_safeAreaLayoutGuideBottom).inset(0);
    }];
    AddStudents = [[UIButton alloc] initWithFrame:CGRectMake(350, 680, 58, 58)];
    [AddStudents setImage:[UIImage imageNamed:@"组 4"] forState:UIControlStateNormal];
    [AddStudents addTarget:self action:@selector(AddStudent) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:AddStudents];
    [AddStudents mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(self.view.mas_safeAreaLayoutGuideBottom).inset(60);
        make.right.mas_equalTo(-16);
        make.size.height.mas_equalTo(58);
        make.size.width.mas_equalTo(58);
    }];
    // Do any additional setup after loading the view from its nib.
}
- (void)AddStudent{
    [self.navigationController pushViewController:[AddClassDetailsViewController new] animated:YES];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ClassDetailsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ClassDetailsTableViewCell"];
    if (!cell) {
        cell = [[ClassDetailsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ClassDetailsTableViewCell"];
    }
    return cell;
}
- (IBAction)BackBtn:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
